<template>
  <el-tooltip v-for="word in props.wordList" :key="word.enWord" class="box-item" effect="dark"
    :content="`${word.enWord}: ${word.zhWord}`" placement="top">
    <div class="word">
      <span class="word-en">{{ word.enWord }}</span> :
      <span class="word-zh">{{ word.zhWord }}</span>
    </div>
  </el-tooltip>
</template>

<script lang="ts" setup>
import { Word } from '@/model/index'
import { defineProps, PropType } from 'vue'
const props = defineProps({
  wordList: {
    type: Array as PropType<Word[]>,
    default: () => {
      return []
    }
  }
})
</script>
<style lang="scss" scoped>
.word {
  width: 25%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
  color: #222;
  border-radius: 4px;
  font-size: 14px;
  line-height: 32px;
  height: 32px;

  .word-en {
    vertical-align: top;
    max-width: 85px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    padding-left: 10px;
  }

  .word-zh {
    vertical-align: top;
    padding-right: 15px;
  }
}

.word:hover {
  background-color: #198764;
  color: #ffffff;
}
</style>
